<!--
 * @FilePath     : /study_code/layui/15-22.html
 * @Description  : 搜索和分页
 * @Date         : 2025-04-09 15:50:51
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-09 16:18:40
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <button class="btn" id="demo3-5">每页5条</button>
    <button class="btn" id="demo3-10">每页10条</button>
    <button class="btn" id="demo3-20">每页20条</button>

    <hr />

    <div id="demo1" class="xm-select-demo"></div>

    <script src="/xm-select/dist/xm-select.js"></script>
    <script>
      // 生成测试数据
      var data = []
      for (var i = 0; i < 100; i++) {
        data.push({
          name: '测试数据' + i,
          value: i,
        })
      }

      var demo1 = xmSelect.render({
        el: '.xm-select-demo',
        data: data,

        //
        paging: true,
        pageSize: 5,
        filterable: true,
      })

      document.getElementById('demo3-5').onclick = function () {
        demo3.update({
          pageSize: 5,
        })
      }

      document.getElementById('demo3-10').onclick = function () {
        demo3.update({
          pageSize: 10,
        })
      }

      document.getElementById('demo3-20').onclick = function () {
        demo3.update({
          pageSize: 20,
        })
      }
    </script>
  </body>
</html>
